/*
	This file is part of AVRCppLib.

    AVRCppLib is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    AVRCppLib is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with AVRCppLib.  If not, see <http://www.gnu.org/licenses/>.

    Copyright (C) Maxime Lemonnier 2007-2011
 */

#ifndef Timer16bits3OCR_H_
#define Timer16bits3OCR_H_

#include "../Utils/CppExtensions.h"
#include "../Utils/BitManipulation.h"
#include "Prescalers.h"
#include "TimerOutputCompareModes.h"
#include "TimerWaveGenerationModes.h"
#include "Counter.h"
#include "Comparator.h"
#include "Capturer.h"

namespace Timers
{

class Timer16bits3OCR
{

public:

	virtual ~Timer16bits3OCR();

	static Timer16bits3OCR * getTimer16bits3OCR(size_t number);

	inline void setWaveGenerationMode(uint8_t wgm3, uint8_t wgm2, uint8_t wgm1, uint8_t wgm0) FORCE_INLINE;

	inline Counter16 * getCounter() FORCE_INLINE;

	inline Comparator16 * getComparatorA() FORCE_INLINE;

	inline Comparator16 * getComparatorB() FORCE_INLINE;

	inline Comparator16 * getComparatorC() FORCE_INLINE;

	inline Capturer16 * getCapturer() FORCE_INLINE;

protected:

	Timer16bits3OCR(IOAddress tccra, uint8_t comaMask, uint8_t combMask, uint8_t comcMask, uint8_t wgmLSBMask,
			IOAddress tccrb, uint8_t wgmMSBMask, uint8_t csMask,
			IOAddress tccrc,
			IOAddress16 tcnt, IOAddress16 ocra, IOAddress16 ocrb, IOAddress16 ocrc, IOAddress16 icr,
			IOAddress timsk, uint8_t toie, uint8_t toieCallbackVectorNumber, uint8_t ociea, uint8_t ocieaCallbackVectorNumber, uint8_t ocieb, uint8_t ociebCallbackVectorNumber, uint8_t ociec, uint8_t ociecCallbackVectorNumber, uint8_t icie, uint8_t icieCallbackVectorNumber,
			IOAddress tifr, uint8_t tov, uint8_t ocfa, uint8_t ocfb, uint8_t ocfc, uint8_t icf);




	IOAddress tccra;
	IOAddress tccrb;
	IOAddress tccrc;

	IOAddress16 icr;

	IOAddress timsk;
	uint8_t icie;

	IOAddress tifr;
	uint8_t icf;

	Counter16 counter;

	Comparator16 comparatorA;
	Comparator16 comparatorB;
	Comparator16 comparatorC;

	Capturer16 capturer;
};

#include "Timer16bits3OCR-definitions.h"

}

#endif /* Timer16bits3OCR_H_ */
